﻿<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>DR钻戒后台管理系统</title>
    <link rel="stylesheet" href="css/public.css"/>
    <link rel="stylesheet" href="css/style.css"/>
    <script src="../js/jquery-1.12.4.js"></script>
</head>
<script type="text/javascript">
    function DeleteAdmin(id){
        if (confirm("确定删除吗?")){
            location.href="http://localhost:8080/DiamondRing/BackDeleteServlet?ID="+id;
        }
    }

    function UpdateAdminInfo(id){
        location.href="http://localhost:8080/DiamondRing/back-stage-Management/userUpdate.html?ID="+id;
        sessionStorage.removeItem("Id");
        sessionStorage.Id=id;
    }



    function LookAdminInfo(id){
            location.href="http://localhost:8080/DiamondRing/back-stage-Management/userView.html?ID="+id;
            sessionStorage.removeItem("Id");
            sessionStorage.Id=id;
    }



    $(function () {
        $.getJSON("http://localhost:8080/DiamondRing/BackSelectServlet",function (data) {
            sessionStorage.json=data
            $.each(data,function () {
                $(".providerTable").append("  <tr  id='" + this.iD + "' >\n" +
                    "                    <td>"+this.iD+"</td>\n" +
                    "                    <td>"+this.name+"</td>\n" +
                    "                    <td>"+this.sex+"</td>\n" +
                    "                    <td>"+this.age+"</td>\n" +
                    "                    <td>"+this.phone+"</td>\n" +
                    "                    <td>\n" +
                    "                        <a href=\"javascript:void(0)\" onclick='LookAdminInfo("+this.iD+")'><img src=\"img/read.png\" alt=\"查看\" title=\"查看\"/></a>\n" +
                    "                        <a href=\"javascript:void(0)\" onclick='UpdateAdminInfo("+this.iD+")'><img src=\"img/xiugai.png\" alt=\"修改\" title=\"修改\"/></a>\n" +
                    "                        <a href=\"javascript:void(0)\" onclick='DeleteAdmin("+this.iD+")'><img src=\"img/schu.png\" alt=\"删除\" title=\"删除\"/></a>\n" +
                    "                    </td>\n" +
                    "                </tr>")
            });
        });

        $("#SelectName").click(function () {
            $(".providerTable").empty();
            let name =$("#name").val();
            $.getJSON("http://localhost:8080/DiamondRing/BackSelectNameServlet","SelectName="+name,function (data) {
                $(".providerTable").append(" <tr class=\"firstTr\">\n" +
                    "                    <th width=\"15%\">用户编码</th>\n" +
                    "                    <th width=\"15%\">用户名称</th>\n" +
                    "                    <th width=\"15%\">性别</th>\n" +
                    "                    <th width=\"15%\">年龄</th>\n" +
                    "                    <th width=\"15%\">电话</th>\n" +
                    "                    <th width=\"30%\">操作</th>\n" +
                    "                </tr>  " )
                $.each(data,function () {
                    $(".providerTable").append(
                                        "<tr  id='" + this.iD + "' >\n" +
                        "                    <td>"+this.iD+"</td>\n" +
                        "                    <td>"+this.name+"</td>\n" +
                        "                    <td>"+this.sex+"</td>\n" +
                        "                    <td>"+this.age+"</td>\n" +
                        "                    <td>"+this.phone+"</td>\n" +
                        "                    <td>\n" +
                        "                        <a class='user' href=\"javascript:void(0)\" onclick='LookAdminInfo("+this.iD+")'><img src=\"img/read.png\" alt=\"查看\" title=\"查看\"/></a>\n" +
                        "                        <a href=\"javascript:void(0)\" onclick='UpdateAdminInfo("+this.iD+")'><img src=\"img/xiugai.png\" alt=\"修改\" title=\"修改\"/></a>\n" +
                        "                        <a href=\"javascript:void(0)\" onclick='DeleteAdmin("+this.iD+")'><img src=\"img/schu.png\" alt=\"删除\" title=\"删除\"/></a>\n" +
                        "                    </td>\n" +
                        "                </tr>")
                });
            });
        });
    })
</script>
<body>
<!--头部-->
    <header class="publicHeader">
        <h1>DR钻戒后台管理系统</h1>
        <div class="publicHeaderR">
            <a href="login.html">退出</a>
        </div>
    </header>
<!--时间-->
    <section class="publicTime">
        <span id="time">2015年1月1日 11:11  星期一</span>
        <a href="#">温馨提示：为了能正常浏览，请使用高版本浏览器!</a>
    </section>
<!--主体内容-->
    <section class="publicMian ">
        <div class="left">
            <h2 class="leftH2"><span class="span1"></span>功能列表 <span></span></h2>
            <nav>
                <ul class="list">
                    <li><a href="billList.html">订单管理</a></li>
                    <li><a href="providerList.html">商品管理</a></li>
                    <li  id="active"><a href="userList.html">用户管理</a></li>
                    <li><a href="password.html">密码修改</a></li>
                    <li><a href="login.html">退出系统</a></li>
                </ul>
            </nav>
        </div>
        <div class="right">
            <div class="location">
                <strong>你现在所在的位置是:</strong>
                <span>用户管理页面</span>
            </div>
            <div class="search">
                <span>用户名：</span>
                <input type="text" name="SelectName" id="name"  placeholder="请输入用户名"/>
                <input type="button" id="SelectName" value="查询" />
                <a href="userAdd.html">添加用户</a>
            </div>
            <!--用户-->
            <table class="providerTable" cellpadding="0" cellspacing="0">
                <tr class="firstTr">
                    <th width="15%">用户编码</th>
                    <th width="15%">用户名称</th>
                    <th width="15%">性别</th>
                    <th width="15%">年龄</th>
                    <th width="15%">电话</th>
                    <th width="30%">操作</th>
                </tr>
            </table>
        </div>
    </section>
    <footer class="footer">
    </footer>
<script src="js/jquery.js"></script>
<script src="js/js.js"></script>
<script src="js/time.js"></script>
</body>
</html>